package com.shop.model.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rsp {


    private int code;

    private String msg;

    private Object content;

    public static Rsp success(Object object) {
        Rsp rsp = new Rsp();
        rsp.setCode(200);
        rsp.setMsg("请求成功");
        rsp.setContent(object);

        return rsp;
    }


    public static Rsp fail() {
        Rsp rsp = new Rsp();

        rsp.setCode(500);

        return rsp;
    }


    public Rsp code(int code) {

        this.setCode(code);

        return this;
    }

    public Rsp msg(String msg) {

        this.setMsg(msg);

        return this;
    }

}
